import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

const routes = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/home',
        name: 'home',
        component: resolve => require(['../views/Home.vue'], resolve),
        redirect: '/home/opinionManagement',
        meta: {
            title: '首页'
        },
        children: [
            {
                path: '/homes/homes',
                name: 'homes',
                component: resolve => require(['../components/homes/homes.vue'], resolve),
                meta: {
                    title: '医院信息',
                    permission: true,
                    index: 'homes'
                }
            },
            {
                path: '/basic/hospital',
                name: 'hospital',
                component: resolve => require(['../components/basic/hospital.vue'], resolve),
                meta: {
                    title: '医院信息',
                    permission: true,
                    index: 'hospital'
                }
            },
            {
                path: '/basic/Department',
                name: 'Department',
                component: resolve => require(['../components/basic/Department.vue'], resolve),
                meta: {
                    title: '部门科室',
                    permission: true,
                    index: 'Department'
                }
            },
            {
                path: '/basic/contractGroup',
                name: 'ContractGroup',
                component: resolve => require(['../components/basic/contractGroup.vue'], resolve),
                meta: {
                    title: '团检分组',
                    permission: true,
                    index: 'ContractGroup'
                }
            },
            {
                path: '/basic/staff',
                name: 'staff',
                component: resolve => require(['../components/basic/staff.vue'], resolve),
                meta: {
                    title: '员工信息',
                    permission: true,
                    index: 'staff'
                }
            },
            {
                path: '/basic/physicalProject',
                name: 'physicalProject',
                component: resolve => require(['../components/basic/physicalProject.vue'], resolve),
                meta: {
                    title: '体检项目设置',
                    permission: true,
                    index: 'physicalProject'
                }
            },
            {
                path: '/basic/physicalSet',
                name: 'physicalSet',
                component: resolve => require(['../components/basic/physicalSet.vue'], resolve),
                meta: {
                    title: '体检套餐设置',
                    permission: true,
                    index: 'physicalSet'
                }
            },
            {
                path: '/basic/physicalResult',
                name: 'physicalResult',
                component: resolve => require(['../components/basic/physicalResult.vue'], resolve),
                meta: {
                    title: '体检常见结果库',
                    permission: true,
                    index: 'physicalResult'
                }
            },
            {
                path: '/basic/physical',
                name: 'physical',
                component: resolve => require(['../components/basic/physical.vue'], resolve),
                meta: {
                    title: '体检套餐',
                    permission: true,
                    index: 'physical'
                }
            },
            {
                path: '/basic/groupmanagement',
                name: 'groupmanagement',
                component: resolve => require(['../components/basic/groupmanagement.vue'], resolve),
                meta: {
                    title: '项目分组管理',
                    permission: true,
                    index: 'groupmanagement'
                }
            },
            {
                path: '/basic/datadictionary',
                name: 'datadictionary',
                component: resolve => require(['../components/basic/datadictionary.vue'], resolve),
                meta: {
                    title: '项目分组管理',
                    permission: true,
                    index: 'datadictionary'
                }
            },
            {
                path: '/basic/suggestion',
                name: 'suggestion',
                component: resolve => require(['../components/basic/suggestion.vue'], resolve),
                meta: {
                    title: '诊断建议',
                    permission: true,
                    index: 'suggestion'
                }
            },
            {
                path: '/visitphysician/workbench',
                name: 'workbench',
                component: resolve => require(['../components/visitphysician/workbench.vue'], resolve),
                meta: {
                    title: '医师工作台',
                    permission: true,
                    index: 'workbench'
                }
            },

            {
                path: '/physicalcenter/collectionlr',
                name: 'collectionlr',
                component: resolve => require(['../components/physicalcenter/collectionlr.vue'], resolve),
                meta: {
                    title: '体检录入',
                    permission: true,
                    index: 'collectionlr'
                }
            },

            {
                path: '/visitphysician/result',
                name: 'visitphysician_result',
                component: resolve => require(['../components/visitphysician/result.vue'], resolve),
                meta: {
                    title: '体检结果',
                    permission: true,
                    index: 'result'
                }
            },
            {
                path: '/visitphysician/save',
                name: 'visitphysician_save',
                component: resolve => require(['../components/visitphysician/save.vue'], resolve),
                meta: {
                    title: '体检结果',
                    permission: true,
                    index: 'result'
                }
            },
            {
                path: '/visitphysician/record',
                name: 'record',
                component: resolve => require(['../components/visitphysician/record.vue'], resolve),
                meta: {
                    title: '体检记录',
                    permission: true,
                    index: 'record'
                }
            },
            {
                path: '/visitphysician/query',
                name: 'query',
                component: resolve => require(['../components/visitphysician/query.vue'], resolve),
                meta: {
                    title: '体检查询',
                    permission: true,
                    index: 'query'
                }
            },
            {
                path: '/system/authority',
                name: 'authority',
                component: resolve => require(['../components/system/authority.vue'], resolve),
                meta: {
                    title: '权限管理',
                    permission: true,
                    index: 'authority'
                }
            },
            {
                path: '/system/useraccess',
                name: 'authority',
                component: resolve => require(['../components/system/useraccess.vue'], resolve),
                meta: {
                    title: '用户授权',
                    permission: true,
                    index: 'useraccess'
                }
            },
            {
                path: '/system/password',
                name: 'authority',
                component: resolve => require(['../components/system/password.vue'], resolve),
                meta: {
                    title: '修改密码',
                    permission: true,
                    index: 'password'
                }
            },
            {
                path: '/system/config',
                name: 'authority',
                component: resolve => require(['../components/system/config.vue'], resolve),
                meta: {
                    title: '全局变量',
                    permission: true,
                    index: 'config'
                }
            },
            {
                path: '/front/register',
                name: 'register',
                component: resolve => require(['../components/front/register.vue'], resolve),
                meta: {
                    title: '参检人员登记',
                    permission: true,
                    index: 'register'
                }
            },
            {
                path: '/front/print',
                name: 'print',
                component: resolve => require(['../components/front/print.vue'], resolve),
                meta: {
                    title: '集中打印',
                    permission: true,
                    index: 'print'
                }
            },

            {
                path: '/visitphysician/confirmList',
                name: 'confirmList',
                component: resolve => require(['../components/visitphysician/confirmList.vue'], resolve),
                meta: {
                    title: '收表查询',
                    permission: true,
                    index: 'confirmList'
                }
            },
            {
                path: '/front/subscribe',
                name: 'subscribe',
                component: resolve => require(['../components/front/subscribe.vue'], resolve),
                meta: {
                    title: '预约管理',
                    permission: true,
                    index: 'subscribe'
                }
            },
            {
                path: '/visitphysician/confirm',
                name: 'confirm',
                component: resolve => require(['../components/visitphysician/confirm.vue'], resolve),
                meta: {
                    title: '交表确认',
                    permission: true,
                    index: 'confirm'
                }
            },
            {
                path: '/front/registersetand',
                name: 'registersetand',
                component: resolve => require(['../components/front/registersetand.vue'], resolve),
                meta: {
                    title: '参检人员管理',
                    permission: true,
                    index: 'registersetand'
                }
            },
            {
                path: '/front/contract',
                name: 'contract',
                component: resolve => require(['../components/front/contract.vue'], resolve),
                meta: {
                    title: '合同管理',
                    permission: true,
                    index: 'contract'
                }
            },
            {
                path: '/front/contractclose',
                name: 'contractclose',
                component: resolve => require(['../components/front/contractclose.vue'], resolve),
                meta: {
                    title: '合同封闭',
                    permission: true,
                    index: 'contractclose'
                }
            },

            {
                path: '/physicalcenter/personnelaudit',
                name: 'personnelaudit',
                component: resolve => require(['../components/physicalcenter/personnelaudit.vue'], resolve),
                meta: {
                    title: '补录',
                    permission: true,
                    index: 'personnelaudit',
                    keepAlive: true
                }
            },
            {
                path: '/physicalcenter/personnelauditSave',
                name: 'personnelauditSave',
                component: resolve => require(['../components/physicalcenter/personnelauditSave.vue'], resolve),
                meta: {
                    title: '补录保存',
                    permission: true,
                    index: 'personnelaudit'
                }
            },
            // 补录修改
            // {
            //     path: '/physicalcenter/personnelauditchange',
            //     name: 'personnelauditchange',
            //     component: resolve => require(['../components/physicalcenter/personnelauditchange.vue'], resolve),
            //     meta: {
            //         title: '结果修改',
            //         permission: true,
            //         index: 'personnelauditchange'
            //     }
            // },
            // {
            //     path: '/physicalcenter/personnelauditchangeSave',
            //     name: 'personnelauditchangeSave',
            //     component: resolve => require(['../components/physicalcenter/personnelauditchangeSave.vue'], resolve),
            //     meta: {
            //         title: '结果修改保存',
            //         permission: true,
            //         index: 'personnelauditchange'
            //     }
            // },

            {
                path: '/physicalcenter/through',
                name: 'through',
                component: resolve => require(['../components/physicalcenter/through.vue'], resolve),
                meta: {
                    title: '初检',
                    permission: true,
                    index: 'through',
                    keepAlive: true
                }
            },
            {
                path: '/physicalcenter/throughSave',
                name: 'throughSave',
                component: resolve => require(['../components/physicalcenter/throughSave.vue'], resolve),
                meta: {
                    title: '初检保存',
                    permission: true,
                    index: 'through'
                }
            },
            {
                path: '/physicalcenter/throughSave',
                name: 'physicalcenter_editCheck',
                component: resolve => require(['../components/physicalcenter/throughSave.vue'], resolve),
                meta: {
                    title: '体检结果编辑',
                    permission: true,
                    index: 'through'
                }
            },
            {
                path: '/physicalcenter/checkdetail',
                name: 'checkdetail',
                component: resolve => require(['../components/physicalcenter/checkdetail.vue'], resolve),
                meta: {
                    title: '结果总检详细',
                    permission: true,
                    index: 'checkdetail'
                }
            },
            {
                path: '/physicalcenter/individual',
                name: 'individual',
                component: resolve => require(['../components/physicalcenter/individual.vue'], resolve),
                meta: {
                    title: '个人客户',
                    permission: true,
                    index: 'individual'
                }
            },
            {
                path: '/physicalcenter/unitcustomer',
                name: 'unitcustomer',
                component: resolve => require(['../components/physicalcenter/unitcustomer.vue'], resolve),
                meta: {
                    title: '单位客户',
                    permission: true,
                    index: 'unitcustomer'
                }
            },
            {
                path: '/physicalcenter/report',
                name: 'report',
                component: resolve => require(['../components/physicalcenter/report.vue'], resolve),
                meta: {
                    title: '报告管理',
                    permission: true,
                    index: 'report'
                }
            },
            {
                path: '/physicalcenter/reportchange',
                name: 'reportchange',
                component: resolve => require(['../components/physicalcenter/reportchange.vue'], resolve),
                meta: {
                    title: '报告修改',
                    permission: true,
                    index: 'reportchange'
                }
            },
            {
                path: '/physicalcenter/highrisk',
                name: 'highrisk',
                component: resolve => require(['../components/physicalcenter/highrisk.vue'], resolve),
                meta: {
                    title: '高危管理',
                    permission: true,
                    index: 'highrisk'
                }
            },
            {
                path: '/physicalcenter/setMeal',
                name: 'setMeal',
                component: resolve => require(['../components/physicalcenter/setMeal.vue'], resolve),
                meta: {
                    title: '套餐管理',
                    permission: true,
                    index: 'setMeal'
                }
            },
            {
                path: '/physicalcenter/recheck',
                name: 'recheck',
                component: resolve => require(['../components/physicalcenter/recheck.vue'], resolve),
                meta: {
                    title: '复检',
                    permission: true,
                    index: 'recheck',
                    keepAlive: true,
                }
            },
            {
                path: '/physicalcenter/recheckSave',
                name: 'recheckSave',
                component: resolve => require(['../components/physicalcenter/recheckSave.vue'], resolve),
                meta: {
                    title: '复检',
                    permission: true,
                    index: 'recheck'
                }
            },
            {
                path: '/physicalcenter/collection',
                name: 'collection',
                component: resolve => require(['../components/physicalcenter/collection.vue'], resolve),
                meta: {
                    title: '结果审核编辑',
                    permission: true,
                    index: 'collection'
                }
            },

        ]
    },
    {
        path: '/login',
        component: resolve => require(['../views/Login.vue'], resolve)
    },
    {
        path: '/test',
        component: resolve => require(['../views/Test.vue'], resolve)
    },
    {
        path: '*',
        redirect: '/home/404'
    }
]
const router = new Router({
    routes,
    // mode: 'history',
    // scrollBehavior(to, from, savedPosition) {
    //     if (savedPosition) {
    //         return savedPosition
    //     } else {
    //         return {x: 0, y: 0}
    //     }
    // }
})

export default router
